/*
 ============================================================================
 Name		: xnetAppView.cpp
 Author	  : antterminator
 Copyright   : Your copyright notice
 Description : Application view implementation
 ============================================================================
 */

// INCLUDE FILES
#include <coemain.h>
#include "xnetAppView.h"

// ============================ MEMBER FUNCTIONS ===============================
struct TEmptyAsserter {
	TEmptyAsserter()
	:XASSERT_A(*this)
	,XASSERT_B(*this) {

	}

	//void xpanic(const TDesC&, TInt) {}
	void xleave(TInt) {}
	void xmessage(const TDesC&) {}

	TEmptyAsserter& XASSERT_A;
	TEmptyAsserter& XASSERT_B;
};

#define XASSERT_A(x) XASSERT_IMPL(x, B)
#define XASSERT_B(x) XASSERT_IMPL(x, A)
#define XASSERT_IMPL(x, next) XASSERT_A.XASSERT_##next

#define xassert(expr) if (false) ; else TEmptyAsserter().XASSERT_A
#define xtrace_variable(expr, args)
#define xpanic(x, y) dummy

struct _empty_asserter {
	char dummy;
};

const _empty_asserter _xasserter = { 0 };


// -----------------------------------------------------------------------------
// CxnetAppView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CxnetAppView* CxnetAppView::NewL(const TRect& aRect)
{
	xtrace_variable("variable foobar", (i)(j)(i));
	
	CxnetAppView* self = CxnetAppView::NewLC(aRect);
	CleanupStack::Pop(self);
	return self;
}

// -----------------------------------------------------------------------------
// CxnetAppView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CxnetAppView* CxnetAppView::NewLC(const TRect& aRect)
{
	CxnetAppView* self = new (ELeave) CxnetAppView;
	CleanupStack::PushL(self);
	self->ConstructL(aRect);
	return self;
}

// -----------------------------------------------------------------------------
// CxnetAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CxnetAppView::ConstructL(const TRect& aRect)
{
	// Create a window for this application view
	CreateWindowL();

	// Set the windows size
	SetRect(aRect);

	// Activate the window, which makes it ready to be drawn
	ActivateL();
}

// -----------------------------------------------------------------------------
// CxnetAppView::CxnetAppView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CxnetAppView::CxnetAppView()
{
	// No implementation required
}

// -----------------------------------------------------------------------------
// CxnetAppView::~CxnetAppView()
// Destructor.
// -----------------------------------------------------------------------------
//
CxnetAppView::~CxnetAppView()
{
	// No implementation required
}

// -----------------------------------------------------------------------------
// CxnetAppView::Draw()
// Draws the display.
// -----------------------------------------------------------------------------
//
void CxnetAppView::Draw(const TRect& /*aRect*/) const
{
	// Get the standard graphics context
	CWindowGc& gc = SystemGc();

	// Gets the control's extent
	TRect drawRect(Rect());

	// Clears the screen
	gc.Clear(drawRect);

}

// -----------------------------------------------------------------------------
// CxnetAppView::SizeChanged()
// Called by framework when the view size is changed.
// -----------------------------------------------------------------------------
//
void CxnetAppView::SizeChanged()
{
	DrawNow();
}

// -----------------------------------------------------------------------------
// CxnetAppView::HandlePointerEventL()
// Called by framework to handle pointer touch events.
// Note: although this method is compatible with earlier SDKs, 
// it will not be called in SDKs without Touch support.
// -----------------------------------------------------------------------------
//
void CxnetAppView::HandlePointerEventL(const TPointerEvent& aPointerEvent)
{

	// Call base class HandlePointerEventL()
	CCoeControl::HandlePointerEventL(aPointerEvent);
}

// End of File
